<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" 
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://shale.apache.org/validator">

    <f:view>
        <f:loadBundle var="text" basename="#{basePage.bundleName}"/>
        <head>
            <title>#{text['absent_one_day.title']}</title>
            <meta name="menu" content="MainMenu"/>
            <meta name="heading" content="#{text['absent_one_day.heading']}"/>
        </head>

        <h:form id="absentOneDayForm" onsubmit="return validateAbsentOneDayForm(this)">

            <h:panelGrid columns="3">

                <h:panelGroup styleClass="info"><h:outputText value="#{text['absent_one_day.message']}"/></h:panelGroup>
                <h:outputText/><h:outputText/>

                <h:outputLabel styleClass="desc" for="checkDate" value="#{text['absent_one_day.checkDate']} #{text['date.format']}"/>
                <t:message for="checkDate" styleClass="fieldError"/>
                <h:inputText value="#{absentOneDayForm.checkDate}" id="checkDate" required="true" styleClass="text medium">
                    <f:convertDateTime for="checkDate" pattern="#{text['date.format']}" type="date"  />
                    <v:commonsValidator client="true" type="required" arg="#{text['absent_one_day.checkDate']}"/>
                </h:inputText>

                <h:outputLabel styleClass="desc" for="absentType" value="#{text['absent_one_day.type']}"/>
                <t:message for="absentType" styleClass="fieldError"/>
                <h:selectOneMenu value="#{absentOneDayForm.absent.type}" id="absentType" required="true" styleClass="select">
                    <f:selectItems value="#{absentOneDayForm.types}"/>
                    <v:commonsValidator client="true" type="required" arg="#{text['absent_one_day.type']}"/>
                </h:selectOneMenu>

                <h:outputLabel styleClass="desc" for="reason" value="#{text['absent_one_day.reason']}"/>
                <t:message for="reason" styleClass="fieldError"/>
                <h:inputText value="#{absentOneDayForm.absent.remark}" id="reason" required="true" styleClass="text medium">
                    <v:commonsValidator client="true" type="required" arg="#{text['absent_one_day.reason']}"/>
                </h:inputText>
                
                <h:panelGroup styleClass="buttonBar bottom">
                    <h:commandButton value="#{text['button.save']}" action="#{absentOneDayForm.save}" id="save" styleClass="button"/>
                    <h:commandButton value="#{text['button.cancel']}" action="mainMenu" immediate="true"
                                     id="cancel" styleClass="button" onclick="bCancel=true"/>
                </h:panelGroup>
            </h:panelGrid>
        </h:form>

        <v:validatorScript functionName="validateAbsentOneDayForm"/>

        <script type="text/javascript">
            Form.focusFirstElement($('absentOneDayForm'));
            highlightFormElements();
        </script>

    </f:view>
</html>
